using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class ControlSpawn : ConTrolLogic
{
	public ControlSpawn(int _col, int _row, Sugar[,] _arrSugar, MapLoad _map)
	{
		col = _col;
		row = _row;
		arrSugar = _arrSugar;
		mapLoad = _map;
	}
	public override void CheckLogic()
	{
		int i = col;
		for (int j = mapLoad.row  -1; j >= 0; j--)
		{
			if (arrSugar[i, j].stt == SugarStatus.Transparent)
			{
				Sugar sugar = arrSugar[i, j];
				if (sugar != null)
				{
					sugar.stt = SugarStatus.HaveSomething;
					//init and reinit sugar
					sugar.colorCd = DUtil.RandomColorSugar();
					//sugar.level = 1;
					sugar.RefreshSugar();
					sugar.SetIndex(i, j);
					sugar.MoveToStartPos();
				
				}
			}
		}
	}	
}
